Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Nov 4, 2024

Summary by CodeRabbit

Release Notes

  • Documentation Updates
    • Deprecation Notice: Updated the Lucia integration guide to indicate its deprecated status.
    • Terminology Change: Updated the Next.js authentication guide to reflect the new name "Auth.js."
    • Edge Runtime Clarity: Enhanced the guide on deploying ZenStack to edge environments with clearer instructions and a new "Caveats" section.
    • New Guide: Introduced a comprehensive guide for typing JSON fields within the ZenStack framework.
    • ZModel Enhancements: Improved the ZModel language reference with new sections and attributes for better clarity and functionality.
    • CLI Documentation Update: Refined the ZenStack CLI documentation, particularly for the repl command, adding new options and clarifying existing ones.
    • Introduction of ZModel Language: Launched the ZModel language documentation, detailing its features and custom attributes for enhanced schema definitions.

@vercel
Copy link

vercel bot commented Nov 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zenstack-new-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 2:43am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2024

Walkthrough

The pull request includes significant updates to several documentation files related to authentication and data modeling in the ZenStack framework. Key changes involve marking the Lucia integration as deprecated, updating references from "NextAuth" to "Auth.js," enhancing clarity in edge deployment guidelines, introducing a new guide on typing JSON fields, and expanding the ZModel language reference. These modifications aim to improve user awareness and documentation clarity while retaining the technical content relevant to existing implementations.

Changes

File Path Change Summary
docs/guides/authentication/lucia.md Title updated to indicate deprecation; added note on Lucia's inactive development; content structure retained.
docs/guides/authentication/next-auth.md Updated terminology from "NextAuth" to "Auth.js"; adjusted examples and descriptions accordingly.
docs/guides/edge.md Title simplified; rephrased introduction; clarified edge-compatible database drivers; added "Caveats" section.
docs/guides/typing-json.md New documentation introduced for typing JSON fields; includes examples and validation details.
docs/reference/zmodel-language.md Enhanced clarity; added sections on Type construct and @json attribute; updated field definitions.
docs/reference/cli.md Updated --prisma-client option default path; added --load-path option for loading ZenStack modules.
docs/the-complete-guide/part1/1-zmodel.md Introduced ZModel language with custom attributes; added new syntax features and examples.

Possibly related PRs

  • doc: add Lucia Auth doc #323: This PR adds documentation for Lucia Auth, which is directly related to the main PR's changes indicating the deprecation of Lucia integration.
  • Update lucia.md #325: This PR updates lucia.md by removing redundant content, which is relevant as it pertains to the same document being modified in the main PR.
  • Update lucia.md #326: This PR makes a minor adjustment in lucia.md regarding the description of Lucia's Prisma adapter, which is relevant to the same document as the main PR.
  • doc: updates about the check API #378: This PR updates the documentation for the check API, which may relate to the overall context of authentication and permissions discussed in the main PR regarding the deprecation of Lucia.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (13)
docs/guides/authentication/lucia.md (3)

7-11: Enhance the deprecation notice with migration guidance.

While the deprecation notice is clear, it would be more helpful to provide guidance on recommended alternatives for authentication. Consider adding information about preferred authentication solutions (e.g., Auth.js) and potential migration paths.

 # Integrating With Lucia (Deprecated)

 :::info
-Lucia's is [not in active development anymore](https://github.com/lucia-auth/lucia/discussions/1714).
+Lucia is [no longer in active development](https://github.com/lucia-auth/lucia/discussions/1714). We recommend using [Auth.js](./auth-js) for new projects. For migration guidance, please refer to our [migration guide](../migrations/lucia-to-authjs).
 :::

Line range hint 13-24: Consider adding a maintenance status banner.

While the technical content remains accurate, it would be helpful to add a prominent notice at the top of each major section indicating that while this integration still works, it's in maintenance mode and won't receive future updates. This helps users make informed decisions when implementing authentication in their projects.

+:::note
+While this integration remains functional, it is in maintenance mode and won't receive future updates. Consider using our actively maintained authentication solutions for new projects.
+:::

[Lucia](https://lucia-auth.com/) is an auth library for your server that abstracts away the complexity of handling sessions...

10-10: Fix typo in deprecation notice.

There's a grammatical error in the deprecation notice.

-Lucia's is [not in active development anymore](https://github.com/lucia-auth/lucia/discussions/1714).
+Lucia is [not in active development anymore](https://github.com/lucia-auth/lucia/discussions/1714).
docs/guides/typing-json.md (6)

6-16: Enhance the Preview feature documentation.

Consider adding:

  • A note explaining what "Preview" means for users (e.g., API stability, production readiness)
  • The minimum version of ZenStack required for this feature

47-49: Provide more context about type inheritance limitations.

Consider expanding on:

  • Why inheritance isn't supported yet
  • What kind of inheritance will be supported in future releases
  • Any workarounds available in the meantime

64-68: Expand @JSON attribute documentation.

Consider adding:

  • Available options/parameters for the @JSON attribute
  • Whether it supports arrays or nested objects
  • Any performance implications

74-78: Clarify import path in the example.

The import path ~/db is project-specific. Consider:

  • Using a more generic import path
  • Adding a note about how to set up the database client
-import { prisma } from '~/db';
+import { PrismaClient } from '@prisma/client';
+
+const prisma = new PrismaClient();

125-171: Enhance validation examples and error handling guidance.

Consider adding:

  • More complex validation scenarios (e.g., conditional validation, custom validators)
  • Best practices for handling validation errors in production
  • Examples of custom error messages

172-198: Expand TypeScript and Zod integration examples.

Consider adding:

  • Advanced usage patterns (e.g., type inference, partial types)
  • Integration examples with popular form libraries (e.g., React Hook Form, Formik)
  • Error handling patterns with Zod schemas
docs/reference/zmodel-language.md (4)

26-33: Consider adding details about multi-schema files support.

While the addition of multi-schema files support to the list is valuable, it would be helpful to add a dedicated section or subsection explaining this feature, including:

  • How to use multiple schema files
  • Best practices for organizing schemas across files
  • Limitations or considerations when using multiple files
🧰 Tools
🪛 LanguageTool

[style] ~26-~26: Consider replacing this phrase with the adverb “naturally” to avoid wordiness.
Context: ...us to build the functionalities we want in a natural way, so we made several extensions to the l...

(IN_A_X_MANNER)


290-332: LGTM! Well-structured Type documentation.

The Type construct documentation is comprehensive and well-organized. It effectively covers the purpose, syntax, use cases, and limitations. The example effectively demonstrates the @JSON attribute usage.

Consider adding a "See also" section at the end to link to related topics like JSON field typing guide and @JSON attribute documentation for better navigation.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~307-~307: You might be missing the article “the” here.
Context: ...Needs to be a valid identifier matching regular expression [A-Za-z][a-za-z0-9_]\*. -...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


Line range hint 1160-1184: Enhance field documentation to clarify model vs. type fields.

While the documentation now correctly covers fields in both models and types, consider adding:

  1. A comparison table or section highlighting differences between model fields and type fields
  2. Specific constraints or behaviors unique to each context
  3. Examples showing field usage in both models and types
🧰 Tools
🪛 LanguageTool

[uncategorized] ~1180-~1180: You might be missing the article “the” here.
Context: ...Needs to be a valid identifier matching regular expression [A-Za-z][a-za-z0-9_]\*. -...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[style] ~1184-~1184: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...*[FIELD_TYPE]** Type of the field. Can be a scalar type, a reference to anothe...

(MISSING_IT_THERE)


699-706: Add more examples for @JSON attribute usage.

The @JSON attribute documentation is clear but could be enhanced with:

  1. Multiple examples showing different use cases
  2. Common patterns and best practices
  3. Examples of how the attribute affects the generated Prisma Client types
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ea766be and b3cff74.

📒 Files selected for processing (5)
  • docs/guides/authentication/lucia.md (1 hunks)
  • docs/guides/authentication/next-auth.md (3 hunks)
  • docs/guides/edge.md (1 hunks)
  • docs/guides/typing-json.md (1 hunks)
  • docs/reference/zmodel-language.md (6 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/guides/authentication/next-auth.md

[uncategorized] ~9-~9: ‘In’ is unnecessary in most cases before the expression ‘next .’.
Context: ...amework for implementing authentication in Next.js projects. It offers a pluggable mech...

(CONFUSION_OF_NN_IN_NEXT_NNP)


[misspelling] ~38-~38: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...arget=blank'). ### Adapter Adapter is a Auth.js mechanism for hooking in custom...

(EN_A_VS_AN)

docs/guides/typing-json.md

[uncategorized] ~51-~51: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...hey aren't tables anyway). ## Defining strongly-typed JSON fields You can then use these typ...

(HYPHENATED_LY_ADVERB_ADJECTIVE)


[style] ~121-~121: This expression usually appears with a “please” in front of it.
Context: ...lational field (which involves joins). [Let us know your thoughts](https://discord.gg/Ykhr7...

(INSERT_PLEASE)

docs/reference/zmodel-language.md

[style] ~26-~26: Consider replacing this phrase with the adverb “naturally” to avoid wordiness.
Context: ...us to build the functionalities we want in a natural way, so we made several extensions to the l...

(IN_A_X_MANNER)


[style] ~250-~250: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...- [NAME]: Name of the model. Needs to be unique in the entire model. Needs to...

(REP_NEED_TO_VB)


[style] ~250-~250: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...Needs to be unique in the entire model. Needs to be a valid identifier matching regular ...

(REP_NEED_TO_VB)


[uncategorized] ~250-~250: You might be missing the article “the” here.
Context: ...Needs to be a valid identifier matching regular expression [A-Za-z][a-za-z0-9_]\*. -...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~307-~307: You might be missing the article “the” here.
Context: ...Needs to be a valid identifier matching regular expression [A-Za-z][a-za-z0-9_]\*. -...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~1180-~1180: You might be missing the article “the” here.
Context: ...Needs to be a valid identifier matching regular expression [A-Za-z][a-za-z0-9_]\*. -...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[style] ~1184-~1184: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...*[FIELD_TYPE]** Type of the field. Can be a scalar type, a reference to anothe...

(MISSING_IT_THERE)

🪛 Markdownlint
docs/guides/authentication/next-auth.md

13-13: Expected: h2; Actual: h3
Heading levels should only increment by one level at a time

(MD001, heading-increment)

🔇 Additional comments (6)
docs/guides/edge.md (6)

Line range hint 101-121: LGTM! Clear distinction between regular and edge runtime imports.

The documentation clearly emphasizes the importance of using @zenstackhq/runtime/edge instead of @zenstackhq/runtime for edge environments, which is crucial for preventing runtime errors.


Line range hint 82-82: Verify the sample repository reference.

The documentation references a specific branch "v2-edge" in the sample repository. Let's verify its existence and content.

#!/bin/bash
# Description: Verify the referenced sample repository branch

# Test: Check if the branch exists and contains edge runtime configuration
gh repo clone zenstackhq/sample-todo-nextjs-tanstack
cd sample-todo-nextjs-tanstack
git checkout v2-edge
rg -l "runtime.*=.*'edge'"

Line range hint 15-17: Verify the Prisma documentation links.

The section references Prisma's edge documentation. Let's ensure the links are valid and up-to-date.

#!/bin/bash
# Description: Check if the referenced Prisma documentation URLs are valid

# Test: Extract and verify URLs
curl -s -o /dev/null -w "%{http_code}" https://www.prisma.io/docs/accelerate
curl -s -o /dev/null -w "%{http_code}" https://www.prisma.io/docs/orm/prisma-client/deployment/edge/overview

Line range hint 123-125: Verify current status of D1 database support.

Let's verify if the limitation regarding D1 database support is still current.

✅ Verification successful

Let me generate additional verification scripts to check for any recent updates or changes regarding D1 database support.


D1 database support limitation is still current

The documentation accurately reflects the current state. D1 database remains unsupported in ZenStack due to Prisma's lack of support for interactive transactions with D1, which ZenStack requires for enforcing access policies. This limitation is consistently documented across multiple files and there have been no recent commits indicating any changes to this status.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any updates regarding D1 database support

# Test 1: Check for D1-related issues or discussions
gh issue list --repo zenstackhq/zenstack --search "D1 database" --state all --limit 5

# Test 2: Check for any D1-related code or documentation
rg -i "cloudflare.*d1|d1.*database"

Length of output: 21113


Script:

#!/bin/bash
# Check for any recent commits or changes related to D1 database support
git log --since="6 months ago" -i --grep="d1\|cloudflare" --pretty=format:"%h %ad %s"

# Check for any recent changes in documentation or code related to D1
rg -i "d1.*support|cloudflare.*d1" --type md --type ts --type js

# Check Prisma's documentation or discussions about D1 support
rg -i "prisma.*d1|d1.*transaction"

Length of output: 1213


Line range hint 84-99: Verify if the bcryptjs workaround is still necessary.

The documentation describes a workaround for bcryptjs compatibility. Let's verify if this is still the current solution or if there's a better approach.

✅ Verification successful

The bcryptjs workaround is still necessary and correctly documented

The workaround for bcryptjs compatibility in edge runtime environments is still necessary and accurately documented. The evidence shows:

  1. The issue is actively present in the codebase:

    • @zenstackhq/runtime still depends on bcryptjs (found in package.json files)
    • The edge runtime compatibility issue with bcryptjs is documented in multiple places
  2. The workaround is the current recommended solution:

    • The documentation in docs/guides/edge.md correctly describes the issue with bcryptjs in Vercel Edge Runtime
    • The solution to add "browser": { "crypto": false } to package.json is still the valid approach
    • This is further confirmed by recent blog posts (e.g., blog/adapt-to-edge/index.md) that discuss this specific workaround
  3. No alternative solution has been implemented:

    • The codebase continues to use bcryptjs for password hashing
    • The edge runtime compatibility is handled through this package.json configuration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for recent issues or discussions about bcryptjs compatibility

# Test 1: Check for related issues
gh issue list --repo zenstackhq/zenstack --label "edge-runtime" --search "bcryptjs" --state all --limit 5

# Test 2: Check if the runtime package still depends on bcryptjs
rg -l "bcryptjs" "package.json"

Length of output: 133


Script:

#!/bin/bash
# Let's try a different approach to verify the bcryptjs usage and edge runtime compatibility

# Check for bcryptjs in all package.json files and package-lock.json
fd "package(-lock)?.json" --exec rg -l "bcryptjs" {}

# Search for bcryptjs related code or configuration
rg -i "bcryptjs" -A 3 -B 3

# Look for edge runtime related configurations
rg -i "edge.*runtime|edge.*function" -A 3 -B 3

Length of output: 47473


6-6: Verify if edge runtime support is stable enough to remove the preview tag.

The title no longer indicates this as a preview feature. Let's verify the stability of edge runtime support in the codebase.

✅ Verification successful

Edge runtime support is now stable and well-documented

Based on the content of edge.md, removing the preview tag is justified because:

  • The documentation shows mature edge runtime support with detailed implementation guidelines
  • Clear support for major platforms (Vercel Edge Runtime and Cloudflare Workers)
  • Specific implementation details and caveats are well documented
  • Working example repository is provided (sample-todo-nextjs-tanstack)
  • Known limitations are explicitly documented (like D1 database support)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any preview/experimental flags or recent issues related to edge runtime

# Test 1: Check for preview/experimental flags in code
rg -i "preview|experimental.*edge" 

# Test 2: Check recent edge-related issues
gh issue list --label "edge-runtime" --state all --limit 10

Length of output: 619


Script:

#!/bin/bash
# Let's try a different approach to verify edge runtime stability

# Check for any mentions of edge runtime being preview/experimental in docs
rg -i "preview.*edge|experimental.*edge" docs/

# Look for edge runtime related changes in recent commits
git log --grep="edge" --since="6 months ago" --pretty=format:"%h %s"

# Search for edge runtime implementation files
fd -t f -e ts -e js edge

# Check for any edge-related tests
fd -t f test.*edge

Length of output: 167


Script:

#!/bin/bash
# Let's check the content of the edge.md file and related documentation

# Check the full content of edge.md
cat docs/guides/edge.md

# Look for any edge-related files in the docs directory
fd . docs/ -t f -x grep -l "edge" {} \;

# Check package.json for edge-related dependencies and features
cat package.json | grep -i "edge"

Length of output: 5503

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (8)
docs/guides/typing-json.md (8)

6-16: Consider adding preview feature stability notice and migration guidance.

Since this is a preview feature, it would be helpful to:

  1. Add a notice about potential breaking changes in future releases
  2. Provide guidance on migrating existing untyped JSON fields to typed ones

22-50: Enhance type definition documentation.

Consider adding:

  1. A list of supported field types (are all Prisma scalar types supported?)
  2. Any constraints on field types (e.g., can arrays be used?)
  3. Examples of unsupported type configurations

53-69: Clarify JSON field usage scenarios.

Please add information about:

  1. Whether multiple JSON fields of the same type are allowed in a model
  2. If JSON fields can be optional (e.g., profile Profile? @json)
  3. Default value handling for JSON fields

70-124: Enhance PrismaClient integration examples.

Consider adding:

  1. More complex query examples involving nested JSON fields
  2. Examples of bulk operations (createMany, updateMany)
  3. Performance implications of JSON field queries
🧰 Tools
🪛 LanguageTool

[style] ~121-~121: This expression usually appears with a “please” in front of it.
Context: ...lational field (which involves joins). [Let us know your thoughts](https://discord.gg/Ykhr7...

(INSERT_PLEASE)


121-121: Add "please" to the feedback request.

For better courtesy, revise to: "Please let us know your thoughts on this!"

🧰 Tools
🪛 LanguageTool

[style] ~121-~121: This expression usually appears with a “please” in front of it.
Context: ...lational field (which involves joins). [Let us know your thoughts](https://discord.gg/Ykhr7...

(INSERT_PLEASE)


125-171: Expand validation documentation.

Consider adding:

  1. Complex validation scenarios (e.g., conditional validation)
  2. Performance implications of validation on large JSON objects
  3. Custom validation function examples

172-199: Add practical integration examples.

Consider adding:

  1. Integration examples with popular form libraries (e.g., React Hook Form)
  2. Custom Zod transformations for JSON fields
  3. Error handling best practices

200-208: Enhance limitations section.

Consider adding:

  1. Workarounds for current limitations where possible
  2. Rough timeline estimates for addressing limitations
  3. Any performance or scalability limitations
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b3cff74 and 31b8329.

📒 Files selected for processing (1)
  • docs/guides/typing-json.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/guides/typing-json.md

[uncategorized] ~51-~51: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...hey aren't tables anyway). ## Defining strongly-typed JSON fields You can then use these typ...

(HYPHENATED_LY_ADVERB_ADJECTIVE)


[style] ~121-~121: This expression usually appears with a “please” in front of it.
Context: ...lational field (which involves joins). [Let us know your thoughts](https://discord.gg/Ykhr7...

(INSERT_PLEASE)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
docs/the-complete-guide/part1/1-zmodel.md (1)

178-192: LGTM! Well-structured documentation about comments.

The added documentation tip effectively explains the different types of comments in ZModel and their purposes. The example is clear and demonstrates proper usage of documentation comments.

Consider adding a note about how documentation comments affect generated documentation artifacts (if any) beyond IDE tooltips.

docs/reference/cli.md (1)

161-161: Enhance documentation for the new --load-path option

The description for the new --load-path option could be more detailed to help users understand:

  • What specific types of modules are loaded from this path
  • Common scenarios where customizing this path would be useful
  • How it interacts with the --prisma-client option

Consider expanding the description to something like:

-| --load-path <path> | Path to load modules generated by ZenStack. | "node_modules/.zenstack" |
+| --load-path <path> | Path to load ZenStack-generated modules (e.g., enhanced PrismaClient, policy handlers). Useful when using custom build output locations or monorepo setups. | "node_modules/.zenstack" |
docs/reference/zmodel-language.md (2)

699-706: Consider enhancing the @JSON attribute documentation.

While the documentation covers the basic functionality, it would be more helpful with:

  1. A practical example showing usage
  2. Details about type validation behavior

Consider adding:

 attribute @json()

Marks a field to be strong-typed JSON. The field's type must be a Type declaration.
+
+### Example
+```zmodel
+type Address {

  • street String
  • city String
  • country String
    +}

+model User {

  • id String @id
  • address Address? @JSON
    +}
    +```

---

`1854-1885`: **Fix minor grammatical issue in the comments section.**

The section provides excellent documentation about different comment styles. There's a minor grammatical issue to fix.

Apply this change:

```diff
-You can also use JSDoc-style comments as documentation, however they are not passed along to the generated Prisma schema.
+You can also use JSDoc-style comments as documentation; however, they are not passed along to the generated Prisma schema.
🧰 Tools
🪛 LanguageTool

[typographical] ~1871-~1871: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...se JSDoc-style comments as documentation, however they are not passed along to the genera...

(HOWEVER_SENTENCE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 31b8329 and cfa0d1e.

📒 Files selected for processing (3)
  • docs/reference/cli.md (1 hunks)
  • docs/reference/zmodel-language.md (7 hunks)
  • docs/the-complete-guide/part1/1-zmodel.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/reference/zmodel-language.md

[style] ~26-~26: Consider replacing this phrase with the adverb “naturally” to avoid wordiness.
Context: ...us to build the functionalities we want in a natural way, so we made several extensions to the l...

(IN_A_X_MANNER)


[style] ~250-~250: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...- [NAME]: Name of the model. Needs to be unique in the entire model. Needs to...

(REP_NEED_TO_VB)


[style] ~250-~250: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...Needs to be unique in the entire model. Needs to be a valid identifier matching regular ...

(REP_NEED_TO_VB)


[style] ~1184-~1184: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...*[FIELD_TYPE]** Type of the field. Can be a scalar type, a reference to anothe...

(MISSING_IT_THERE)


[typographical] ~1871-~1871: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...se JSDoc-style comments as documentation, however they are not passed along to the genera...

(HOWEVER_SENTENCE)

🔇 Additional comments (3)
docs/reference/cli.md (1)

160-160: ⚠️ Potential issue

Breaking Change: Update in --prisma-client default path

The removal of "./" from the default path is a breaking change that should be clearly documented in the release notes. Consider adding a migration note for users who might be relying on the old path format.

Let's check if this path is referenced in other documentation files:

docs/reference/zmodel-language.md (2)

290-332: LGTM! Well-structured documentation for the Type construct.

The section effectively introduces the Type construct with clear explanations, practical use cases, syntax, and examples. The limitations are clearly documented.


Line range hint 1160-1176: LGTM! Clear documentation of field definitions.

The section effectively explains field definitions for both models and types with clear syntax examples.

🧰 Tools
🪛 LanguageTool

[style] ~1184-~1184: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ...*[FIELD_TYPE]** Type of the field. Can be a scalar type, a reference to anothe...

(MISSING_IT_THERE)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
docs/guides/typing-json.md (2)

10-16: Consider enhancing the transition between Prisma and ZenStack features.

While the introduction effectively explains JSON fields and their use cases, consider adding a brief sentence explaining what specific problems ZenStack solves compared to Prisma's basic JSON type support. This would help users better understand the value proposition.

 JSON fields provide great flexibility but at the cost of losing strong typing and validation. ZenStack's strongly typed JSON field feature helps you regain the lost benefits.
+For example, while Prisma only provides basic JSON type support, ZenStack adds TypeScript types, runtime validation, and enhanced developer experience.

202-211: Consider restructuring the limitations section.

The limitations section could be more structured to help users better understand the impact of each limitation. Consider:

  1. Grouping limitations by their impact (e.g., type system limitations vs. runtime limitations)
  2. Adding brief explanations of the implications of each limitation
 ## Limitations
 
 This feature is in preview and has the following limitations:
 
+### Type System Limitations
 1. Types cannot inherit from other types.
 1. Models cannot inherit from types.
 1. Types and abstract models are conceptually similar and they should probably be consolidated.
+
+### Runtime Limitations
 1. JSON field members cannot be used in access policies.
+
+### Impact and Workarounds
+- For type inheritance limitations, you can currently work around this by duplicating fields
+- For access policy limitations, consider storing sensitive data in regular columns instead of JSON fields
 
 We would like to continue gathering feedback and address these limitations in future releases.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~208-~208: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...abstract models are conceptually similar and they should probably be consolidated. 1...

(COMMA_COMPOUND_SENTENCE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between cfa0d1e and 79ea8d9.

📒 Files selected for processing (1)
  • docs/guides/typing-json.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/guides/typing-json.md

[uncategorized] ~51-~51: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...hey aren't tables anyway). ## Defining strongly-typed JSON fields You can then use these typ...

(HYPHENATED_LY_ADVERB_ADJECTIVE)


[style] ~123-~123: This expression usually appears with a “please” in front of it.
Context: ...lational field (which involves joins). [Let us know your thoughts](https://discord.gg/Ykhr7...

(INSERT_PLEASE)


[uncategorized] ~208-~208: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...abstract models are conceptually similar and they should probably be consolidated. 1...

(COMMA_COMPOUND_SENTENCE)

🔇 Additional comments (2)
docs/guides/typing-json.md (2)

1-9: LGTM! Well-structured document header.

The document follows documentation best practices with proper frontmatter, clear preview status indication, and appropriate attribution to inspiration sources.


18-50: Verify type nesting depth limitations.

The documentation clearly explains type declarations and their current limitations. However, it would be helpful to verify and document if there are any limitations on type nesting depth (how deeply types can be nested within each other).

@ymc9 ymc9 merged commit 0289b94 into main Nov 6, 2024
3 checks passed
@ymc9 ymc9 deleted the docs/release-2.8.0 branch November 6, 2024 04:02
@coderabbitai coderabbitai bot mentioned this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants